package com.hsd.survey.action;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hsd.core.page.entity.PageParams;
import com.hsd.core.page.entity.Pagination;
import com.hsd.survey.service.ISurveyCommonService;

/**
 * <p>
 * 类描述：健康监测
 * <p>
 * 创建人：Abdi
 * <p>
 * 创建时间：2013-10-14 下午10:12:40
 */

@Controller
@RequestMapping("/monitor")
public class SurveyMonitorAction {
	@Autowired
	private ISurveyCommonService commonService;
	
	/**
	 * 健康监测 ：加载问卷模板列表
	 * @param pageParams
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "/loadSurveyList.do")
	public String loadSurveyList(PageParams pageParams,HttpServletRequest request,ModelMap model){
		String name = request.getParameter("name");
		String status = request.getParameter("status");
		Pagination page = commonService.loadSurveyList(pageParams,name,status);

		model.addAttribute("page",page);
		model.addAttribute("name",name);
		return "app/monitor/research/monitor-suryvey-list";
	}
	
	/**
	 * 健康监测 ：加载调研信息列表
	 * @param pageParams
	 * @param request
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "/loadResearchList.do")
	public String loadResearchList(PageParams pageParams,HttpServletRequest request,ModelMap model){
		String surveyname = request.getParameter("surveyname");
		String answername = request.getParameter("answername");
		Pagination page = commonService.loadResearchList(pageParams,surveyname,answername);
		
		model.addAttribute("page",page);
		model.addAttribute("surveyname",surveyname);
		model.addAttribute("answername",answername);
		return "app/monitor/research/monitor-research-list";
	}
}
